#!/bin/env python
# -*- coding: utf-8 -*-

import re

from NetDiskInfo import NetDiskInfo

class NetDiskInfo163(NetDiskInfo):
	def __init__(self):
		NetDiskInfo.__init__(self)
		
		self.diskinfo_pat = re.compile(""".*var fid = '(\d*)'.*var qMax.*"(\d*)".*var qUsed.*"(\d*)".*var cFileMax.*"(\d*)".*var cFolderMax.*"(\d*)".*var cSizeMax.*"(\d*)".*""", re.S)
		
	def parse(self, cont):
		m = self.diskinfo_pat.match(cont)
		if m == None:
			return False
		
		self.id            = m.group(1)
		self.totalsize     = m.group(2)
		self.usedsize      = m.group(3)
		self.filelimit     = m.group(4)
		self.folderlimit   = m.group(5)
		self.filesizelimit = m.group(6)
		
		return True
			
if __name__ == '__main__':
	f = open('main_info.html', "r")
	cont = f.read()
	
	my = NetDiskInfo163()
	my.parse(cont)

	my.print_str()
		